//
//  ClientBlue.h
//  blue_classic_plus
//
//  Created by os on 1/19/24.
//

#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "BlueClassicPlusPlugin.h"

NS_ASSUME_NONNULL_BEGIN

@interface ClientBlue : NSObject<CBCentralManagerDelegate, CBPeripheralDelegate>

@property (nonatomic,assign) BOOL isConnecting;

@property (nonatomic,weak) FlutterEventSink sink;

// 定义一个 CBCentralManager 属性，作为蓝牙客户端
@property (nonatomic, strong) CBCentralManager *centralManager;

@property (nonatomic,copy) NSString * uuid;
@property (nonatomic,copy) NSString * name;

// 定义一个 CBPeripheral 属性，作为连接的外设
@property (nonatomic, strong) CBPeripheral *peripheral;

// 定义一个 CBUUID 属性，作为要订阅的特征的 UUID
@property (nonatomic, strong) CBUUID *characteristicUUID;

// 定义一个初始化方法
- (instancetype)initWithSink:(FlutterEventSink)sink uuid: (NSString *)uuid name:(NSString *)name;

// 定义一个开始扫描的方法
- (void)startScan: (CBCentralManager *)central;

// 结束扫描
- (void)stopScan;

// 结束连接
- (void)bluetoothStopConnect;

@end

NS_ASSUME_NONNULL_END
